<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>许愿详情 - 心愿墙</title>
    <!-- Bootstrap 5 CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Font Awesome 图标 -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
    
    <style>
        :root {
            --primary: #6366f1;
            --primary-light: #a5b4fc;
            --primary-dark: #4338ca;
            --secondary: #ec4899;
            --success: #10b981;
            --danger: #ef4444;
            --text-primary: #1e293b;
            --text-secondary: #64748b;
            --text-light: #94a3b8;
            --bg-light: #f8fafc;
            --bg-white: #ffffff;
            --border-light: #e2e8f0;
            --radius: 12px;
            --shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
            --transition: all 0.3s ease;
        }
        
        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
            background-color: var(--bg-light);
            color: var(--text-primary);
            padding-top: 56px;
            padding-bottom: 70px;
        }
        
        /* 顶部导航 */
        .top-nav {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            height: 56px;
            background-color: var(--bg-white);
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0 16px;
            z-index: 1000;
            border-bottom: 1px solid var(--border-light);
        }
        
        .nav-title {
            font-size: 1.15rem;
            font-weight: 600;
            text-align: center;
            flex: 1;
        }
        
        .nav-btn {
            background: none;
            border: none;
            color: var(--text-secondary);
            width: 36px;
            height: 36px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: var(--transition);
        }
        
        .nav-btn:hover {
            background-color: var(--bg-light);
            color: var(--primary);
        }
        
        /* 许愿详情容器 */
        .wish-detail-container {
            background-color: var(--bg-white);
            margin-bottom: 12px;
        }
        
        /* 许愿内容 */
        .wish-content {
            padding: 16px;
        }
        
        .wish-header {
            display: flex;
            align-items: center;
            gap: 10px;
            margin-bottom: 12px;
        }
        
        .wish-avatar {
            width: 48px;
            height: 48px;
            border-radius: 50%;
            overflow: hidden;
            flex-shrink: 0;
        }
        
        .wish-avatar img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        
        .user-info {
            flex: 1;
        }
        
        .user-name {
            font-size: 1rem;
            font-weight: 600;
        }
        
        .wish-meta {
            display: flex;
            align-items: center;
            gap: 12px;
            font-size: 0.8rem;
            color: var(--text-secondary);
        }
        
        .wish-time {
            display: flex;
            align-items: center;
            gap: 4px;
        }
        
        .wish-category {
            display: inline-block;
            padding: 2px 8px;
            background-color: rgba(99, 102, 241, 0.1);
            color: var(--primary);
            font-size: 0.75rem;
            border-radius: 4px;
        }
        
        .wish-text {
            font-size: 1rem;
            line-height: 1.6;
            margin-bottom: 16px;
        }
        
        /* 许愿图片容器 */
        .wish-images {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(50%, 1fr));
            gap: 4px;
            margin-bottom: 16px;
        }
        
        .wish-image {
            aspect-ratio: 1;
            overflow: hidden;
            border-radius: 8px;
        }
        
        .wish-image img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            transition: var(--transition);
        }
        
        .wish-image img:hover {
            transform: scale(1.05);
        }
        
        /* 许愿标签 */
        .wish-tags {
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
            margin-bottom: 16px;
        }
        
        .wish-tag {
            padding: 3px 10px;
            background-color: rgba(99, 102, 241, 0.1);
            color: var(--primary);
            font-size: 0.8rem;
            border-radius: 4px;
        }
        
        /* 许愿进度 */
        .wish-progress {
            background-color: var(--bg-light);
            padding: 12px;
            border-radius: 8px;
            margin-bottom: 16px;
        }
        
        .progress-header {
            display: flex;
            justify-content: space-between;
            margin-bottom: 8px;
            font-size: 0.9rem;
        }
        
        .progress-label {
            color: var(--text-secondary);
            display: flex;
            align-items: center;
            gap: 6px;
        }
        
        .progress-value {
            font-weight: 600;
        }
        
        .progress-bar-container {
            height: 8px;
            background-color: #e2e8f0;
            border-radius: 4px;
            overflow: hidden;
        }
        
        .progress-bar {
            height: 100%;
            background-color: var(--primary);
            border-radius: 4px;
        }
        
        /* 操作按钮 */
        .wish-actions {
            display: flex;
            justify-content: space-around;
            padding: 12px 0;
            border-top: 1px solid var(--border-light);
            border-bottom: 1px solid var(--border-light);
        }
        
        .action-btn {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 4px;
            color: var(--text-secondary);
            font-size: 0.8rem;
            background: none;
            border: none;
            transition: var(--transition);
            padding: 4px 12px;
        }
        
        .action-btn i {
            font-size: 1.2rem;
        }
        
        .action-btn:hover {
            color: var(--primary);
        }
        
        .action-btn.supported {
            color: var(--secondary);
        }
        
        .action-btn.liked {
            color: var(--danger);
        }
        
        /* 留言区 */
        .comments-section {
            background-color: var(--bg-white);
            padding: 16px;
        }
        
        .comments-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 16px;
        }
        
        .comments-title {
            font-size: 1rem;
            font-weight: 600;
        }
        
        .sort-comments {
            color: var(--primary);
            font-size: 0.85rem;
            display: flex;
            align-items: center;
            gap: 4px;
        }
        
        /* 留言输入框 */
        .comment-input-container {
            display: flex;
            gap: 10px;
            margin-bottom: 20px;
        }
        
        .comment-avatar {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            overflow: hidden;
            flex-shrink: 0;
        }
        
        .comment-avatar img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        
        .comment-input-box {
            flex: 1;
            position: relative;
        }
        
        .comment-input {
            width: 100%;
            padding: 10px 12px;
            border-radius: 20px;
            border: 1px solid var(--border-light);
            background-color: var(--bg-light);
            font-size: 0.9rem;
            resize: none;
            height: 40px;
        }
        
        .comment-input:focus {
            outline: none;
            border-color: var(--primary-light);
        }
        
        .send-comment {
            position: absolute;
            right: 10px;
            top: 50%;
            transform: translateY(-50%);
            background: none;
            border: none;
            color: var(--primary);
            font-size: 1rem;
        }
        
        /* 留言列表 */
        .comments-list {
            display: flex;
            flex-direction: column;
            gap: 16px;
        }
        
        .comment-item {
            display: flex;
            gap: 10px;
        }
        
        .comment-content {
            flex: 1;
        }
        
        .comment-header {
            display: flex;
            justify-content: space-between;
            margin-bottom: 4px;
        }
        
        .comment-author {
            font-size: 0.85rem;
            font-weight: 600;
        }
        
        .comment-time {
            font-size: 0.75rem;
            color: var(--text-secondary);
        }
        
        .comment-text {
            background-color: var(--bg-light);
            padding: 8px 12px;
            border-radius: 16px;
            font-size: 0.9rem;
            margin-bottom: 6px;
            position: relative;
        }
        
        .comment-text:before {
            content: '';
            position: absolute;
            left: -8px;
            top: 8px;
            width: 0;
            height: 0;
            border-top: 8px solid transparent;
            border-right: 8px solid var(--bg-light);
            border-bottom: 8px solid transparent;
        }
        
        .comment-actions {
            display: flex;
            gap: 16px;
            font-size: 0.75rem;
        }
        
        .comment-action {
            color: var(--text-secondary);
            display: flex;
            align-items: center;
            gap: 4px;
            cursor: pointer;
        }
        
        .comment-action:hover {
            color: var(--primary);
        }
        
        .comment-action.liked {
            color: var(--danger);
        }
        
        /* 回复区 */
        .replies {
            margin-left: 46px;
            margin-top: 10px;
            display: flex;
            flex-direction: column;
            gap: 10px;
        }
        
        .reply-item {
            display: flex;
            gap: 8px;
        }
        
        .reply-content {
            flex: 1;
        }
        
        .reply-text {
            background-color: var(--bg-light);
            padding: 6px 10px;
            border-radius: 12px;
            font-size: 0.85rem;
            margin-bottom: 4px;
            position: relative;
        }
        
        .reply-text:before {
            content: '';
            position: absolute;
            left: -6px;
            top: 6px;
            width: 0;
            height: 0;
            border-top: 6px solid transparent;
            border-right: 6px solid var(--bg-light);
            border-bottom: 6px solid transparent;
        }
        
        .reply-text .author {
            font-weight: 600;
            color: var(--primary);
        }
        
        /* 加载更多评论 */
        .load-more-comments {
            text-align: center;
            padding: 8px;
            color: var(--primary);
            font-size: 0.85rem;
            margin-top: 10px;
            cursor: pointer;
        }
        
        /* 底部导航 */
        .bottom-nav {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            height: 65px;
            background-color: var(--bg-white);
            display: flex;
            justify-content: space-around;
            align-items: center;
            border-top: 1px solid var(--border-light);
            z-index: 1000;
        }
        
        .nav-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            color: var(--text-secondary);
            font-size: 0.7rem;
            text-decoration: none;
        }
        
        .nav-item i {
            font-size: 1.25rem;
            margin-bottom: 4px;
        }
        
        .nav-item.active {
            color: var(--primary);
        }
        
        /* 提示消息 */
        .toast-message {
            position: fixed;
            bottom: 80px;
            left: 50%;
            transform: translateX(-50%);
            background-color: rgba(0, 0, 0, 0.7);
            color: white;
            padding: 8px 16px;
            border-radius: 4px;
            font-size: 0.9rem;
            z-index: 9999;
            opacity: 0;
            transition: opacity 0.3s ease;
        }
        
        .toast-message.show {
            opacity: 1;
        }
        
        /* 举报/更多操作弹窗 */
        .action-modal {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            background-color: var(--bg-white);
            border-top-left-radius: var(--radius);
            border-top-right-radius: var(--radius);
            padding: 16px;
            z-index: 1001;
            transform: translateY(100%);
            transition: transform 0.3s ease;
        }
        
        .action-modal.show {
            transform: translateY(0);
        }
        
        .modal-backdrop {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: rgba(0, 0, 0, 0.5);
            z-index: 1000;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.3s ease;
        }
        
        .modal-backdrop.show {
            opacity: 1;
            pointer-events: auto;
        }
        
        .modal-title {
            font-size: 1.1rem;
            font-weight: 600;
            margin-bottom: 16px;
            text-align: center;
        }
        
        .action-options {
            display: flex;
            flex-direction: column;
            gap: 8px;
        }
        
        .action-option {
            padding: 12px;
            text-align: center;
            background-color: var(--bg-light);
            border-radius: 8px;
            font-size: 0.95rem;
            cursor: pointer;
        }
        
        .action-option.danger {
            color: var(--danger);
        }
        
        .cancel-action {
            margin-top: 12px;
            padding: 12px;
            text-align: center;
            background-color: var(--primary);
            color: white;
            border-radius: 8px;
            font-size: 0.95rem;
            font-weight: 500;
            cursor: pointer;
        }
    </style>
</head>
<body>
    <!-- 顶部导航 -->
    <div class="top-nav">
        <button class="nav-btn" id="backBtn">
            <i class="fas fa-arrow-left"></i>
        </button>
        <div class="nav-title">许愿详情</div>
        <button class="nav-btn" id="moreBtn">
            <i class="fas fa-ellipsis-v"></i>
        </button>
    </div>
    
    <!-- 许愿详情 -->
    <div class="wish-detail-container">
        <div class="wish-content">
            <div class="wish-header">
                <div class="wish-avatar">
                    <img src="https://picsum.photos/id/91/100/100" alt="用户头像">
                </div>
                <div class="user-info">
                    <div class="user-name">咖啡不加糖</div>
                    <div class="wish-meta">
                        <div class="wish-time">
                            <i class="far fa-clock"></i>
                            <span>3天前</span>
                        </div>
                        <div class="wish-category">旅行愿望</div>
                    </div>
                </div>
            </div>
            
            <div class="wish-text">
                计划今年夏天去日本京都旅行，希望能看到美丽的樱花，品尝正宗的日式咖啡和甜点。有没有去过的朋友可以推荐一些小众景点和咖啡馆呀？目前已经存了5000元，还需要再存3000元左右。
            </div>
            
            <div class="wish-images">
                <div class="wish-image">
                    <img src="https://picsum.photos/id/240/300/300" alt="京都风景">
                </div>
                <div class="wish-image">
                    <img src="https://picsum.photos/id/431/300/300" alt="日式咖啡">
                </div>
                <div class="wish-image">
                    <img src="https://picsum.photos/id/292/300/300" alt="日式甜点">
                </div>
                <div class="wish-image">
                    <img src="https://picsum.photos/id/429/300/300" alt="樱花">
                </div>
            </div>
            
            <div class="wish-tags">
                <span class="wish-tag">旅行</span>
                <span class="wish-tag">日本</span>
                <span class="wish-tag">美食</span>
                <span class="wish-tag">计划</span>
            </div>
            
            <div class="wish-progress">
                <div class="progress-header">
                    <div class="progress-label">
                        <i class="fas fa-money-bill-wave"></i>
                        <span>旅行资金</span>
                    </div>
                    <div class="progress-value">62.5% (5000/8000元)</div>
                </div>
                <div class="progress-bar-container">
                    <div class="progress-bar" style="width: 62.5%;"></div>
                </div>
            </div>
            
            <div class="wish-progress">
                <div class="progress-header">
                    <div class="progress-label">
                        <i class="fas fa-calendar-check"></i>
                        <span>计划日期</span>
                    </div>
                    <div class="progress-value">7月15日出发</div>
                </div>
                <div class="progress-bar-container">
                    <div class="progress-bar" style="width: 75%;"></div>
                </div>
            </div>
        </div>
        
        <div class="wish-actions">
            <button class="action-btn comment-btn">
                <i class="far fa-comment"></i>
                <span>32</span>
            </button>
            <button class="action-btn support-btn supported">
                <i class="fas fa-hand-holding-heart"></i>
                <span>76</span>
            </button>
            <button class="action-btn like-btn">
                <i class="far fa-heart"></i>
                <span>342</span>
            </button>
            <button class="action-btn share-btn">
                <i class="far fa-share-alt"></i>
                <span>分享</span>
            </button>
            <button class="action-btn save-btn">
                <i class="far fa-bookmark"></i>
                <span>收藏</span>
            </button>
        </div>
    </div>
    
    <!-- 留言区 -->
    <div class="comments-section">
        <div class="comments-header">
            <div class="comments-title">留言 (32)</div>
            <div class="sort-comments">
                <span>最新</span>
                <i class="fas fa-chevron-down"></i>
            </div>
        </div>
        
        <!-- 留言输入框 -->
        <div class="comment-input-container">
            <div class="comment-avatar">
                <img src="https://picsum.photos/id/64/100/100" alt="我的头像">
            </div>
            <div class="comment-input-box">
                <textarea class="comment-input" placeholder="写下你的留言..."></textarea>
                <button class="send-comment">
                    <i class="fas fa-paper-plane"></i>
                </button>
            </div>
        </div>
        
        <!-- 留言列表 -->
        <div class="comments-list">
            <!-- 评论1 -->
            <div class="comment-item">
                <div class="comment-avatar">
                    <img src="https://picsum.photos/id/65/100/100" alt="用户头像">
                </div>
                <div class="comment-content">
                    <div class="comment-header">
                        <div class="comment-author">夏日清风</div>
                        <div class="comment-time">昨天 10:23</div>
                    </div>
                    <div class="comment-text">
                        京都真的很值得一去！我去年春天去过，推荐伏见稻荷大社，傍晚去人很少，千本鸟居特别壮观。还有一家叫"茶寮都路里"的抹茶甜品店一定要试试！
                    </div>
                    <div class="comment-actions">
                        <div class="comment-action reply-btn">
                            <i class="far fa-comment"></i>
                            <span>回复</span>
                        </div>
                        <div class="comment-action like-btn">
                            <i class="far fa-heart"></i>
                            <span>24</span>
                        </div>
                    </div>
                    
                    <!-- 回复 -->
                    <div class="replies">
                        <div class="reply-item">
                            <div class="comment-avatar">
                                <img src="https://picsum.photos/id/91/100/100" alt="用户头像">
                            </div>
                            <div class="reply-content">
                                <div class="comment-header">
                                    <div class="comment-author">咖啡不加糖</div>
                                    <div class="comment-time">昨天 11:05</div>
                                </div>
                                <div class="reply-text">
                                    <span class="author">@夏日清风</span> 谢谢推荐！伏见稻荷大社我在攻略上看到过，确实很想去。那家甜品店记下来了，一定要去尝尝～
                                </div>
                                <div class="comment-actions">
                                    <div class="comment-action reply-btn">
                                        <i class="far fa-comment"></i>
                                        <span>回复</span>
                                    </div>
                                    <div class="comment-action like-btn liked">
                                        <i class="fas fa-heart"></i>
                                        <span>8</span>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            
            <!-- 评论2 -->
            <div class="comment-item">
                <div class="comment-avatar">
                    <img src="https://picsum.photos/id/237/100/100" alt="用户头像">
                </div>
                <div class="comment-content">
                    <div class="comment-header">
                        <div class="comment-author">音乐漫游者</div>
                        <div class="comment-time">2天前</div>
                    </div>
                    <div class="comment-text">
                        我建议住在京都站附近，交通特别方便。如果想体验日式温泉，可以考虑住一晚温泉旅馆，价格虽然贵一点但体验非常好。另外，京都的公交车一日券很划算，几乎所有景点都能到。
                    </div>
                    <div class="comment-actions">
                        <div class="comment-action reply-btn">
                            <i class="far fa-comment"></i>
                            <span>回复</span>
                        </div>
                        <div class="comment-action like-btn liked">
                            <i class="fas fa-heart"></i>
                            <span>36</span>
                        </div>
                    </div>
                </div>
            </div>
            
            <!-- 评论3 -->
            <div class="comment-item">
                <div class="comment-avatar">
                    <img src="https://picsum.photos/id/177/100/100" alt="用户头像">
                </div>
                <div class="comment-content">
                    <div class="comment-header">
                        <div class="comment-author">书香门第</div>
                        <div class="comment-time">3天前</div>
                    </div>
                    <div class="comment-text">
                        7月份去的话樱花可能已经谢了哦，不过京都的夏日祭也很有特色！可以提前查一下活动日程，能看到很多穿着浴衣的当地人，非常有氛围。
                    </div>
                    <div class="comment-actions">
                        <div class="comment-action reply-btn">
                            <i class="far fa-comment"></i>
                            <span>回复</span>
                        </div>
                        <div class="comment-action like-btn">
                            <i class="far fa-heart"></i>
                            <span>15</span>
                        </div>
                    </div>
                    
                    <!-- 回复 -->
                    <div class="replies">
                        <div class="reply-item">
                            <div class="comment-avatar">
                                <img src="https://picsum.photos/id/91/100/100" alt="用户头像">
                            </div>
                            <div class="reply-content">
                                <div class="comment-header">
                                    <div class="comment-author">咖啡不加糖</div>
                                    <div class="comment-time">3天前</div>
                                </div>
                                <div class="reply-text">
                                    <span class="author">@书香门第</span> 谢谢提醒！我查了一下确实樱花季过了，夏日祭听起来不错，已经加入计划了～
                                </div>
                                <div class="comment-actions">
                                    <div class="comment-action reply-btn">
                                        <i class="far fa-comment"></i>
                                        <span>回复</span>
                                    </div>
                                    <div class="comment-action like-btn">
                                        <i class="far fa-heart"></i>
                                        <span>5</span>
                                    </div>
                                </div>
                            </div>
                        </div>
                        
                        <div class="reply-item">
                            <div class="comment-avatar">
                                <img src="https://picsum.photos/id/338/100/100" alt="用户头像">
                            </div>
                            <div class="reply-content">
                                <div class="comment-header">
                                    <div class="comment-author">篮球小子</div>
                                    <div class="comment-time">2天前</div>
                                </div>
                                <div class="reply-text">
                                    <span class="author">@书香门第</span> 请问夏日祭一般是什么时候举行？我也打算7月去日本。
                                </div>
                                <div class="comment-actions">
                                    <div class="comment-action reply-btn">
                                        <i class="far fa-comment"></i>
                                        <span>回复</span>
                                    </div>
                                    <div class="comment-action like-btn">
                                        <i class="far fa-heart"></i>
                                        <span>3</span>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        
        <!-- 加载更多评论 -->
        <div class="load-more-comments" id="loadMoreComments">
            加载更多评论
        </div>
    </div>
    
    <!-- 底部导航 -->
    <div class="bottom-nav">
        <a href="#" class="nav-item">
            <i class="fas fa-home"></i>
            <span>首页</span>
        </a>
        <a href="#" class="nav-item">
            <i class="fas fa-compass"></i>
            <span>发现</span>
        </a>
        <a href="#" class="nav-item active">
            <i class="fas fa-star"></i>
            <span>心愿墙</span>
        </a>
        <a href="#" class="nav-item">
            <i class="fas fa-comment"></i>
            <span>消息</span>
        </a>
        <a href="#" class="nav-item">
            <i class="fas fa-user"></i>
            <span>我的</span>
        </a>
    </div>
    
    <!-- 更多操作弹窗 -->
    <div class="modal-backdrop" id="modalBackdrop"></div>
    <div class="action-modal" id="actionModal">
        <div class="modal-title">更多操作</div>
        <div class="action-options">
            <div class="action-option">
                <i class="fas fa-share-alt"></i> 分享给好友
            </div>
            <div class="action-option">
                <i class="fas fa-flag"></i> 举报此愿望
            </div>
            <div class="action-option danger">
                <i class="fas fa-user-slash"></i> 屏蔽用户
            </div>
        </div>
        <div class="cancel-action" id="cancelAction">
            取消
        </div>
    </div>
    
    <!-- 提示消息元素 -->
    <div class="toast-message" id="toastMessage"></div>
    
    <!-- Bootstrap JS Bundle with Popper -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
    
    <script>
        // DOM元素
        const backBtn = document.getElementById("backBtn");
        const moreBtn = document.getElementById("moreBtn");
        const modalBackdrop = document.getElementById("modalBackdrop");
        const actionModal = document.getElementById("actionModal");
        const cancelAction = document.getElementById("cancelAction");
        const loadMoreComments = document.getElementById("loadMoreComments");
        const toastMessage = document.getElementById("toastMessage");
        const sendCommentBtn = document.querySelector(".send-comment");
        const commentInput = document.querySelector(".comment-input");
        
        // 初始化
        function init() {
            setupEventListeners();
        }
        
        // 设置事件监听
        function setupEventListeners() {
            // 返回按钮
            backBtn.addEventListener("click", () => {
                history.back();
            });
            
            // 更多操作按钮
            moreBtn.addEventListener("click", () => {
                modalBackdrop.classList.add("show");
                actionModal.classList.add("show");
            });
            
            // 关闭弹窗
            cancelAction.addEventListener("click", closeModal);
            modalBackdrop.addEventListener("click", closeModal);
            
            // 加载更多评论
            loadMoreComments.addEventListener("click", loadMore);
            
            // 发送评论
            sendCommentBtn.addEventListener("click", sendComment);
            
            // 评论输入框自动调整高度
            commentInput.addEventListener("input", adjustTextareaHeight);
            
            // 支持按钮
            document.querySelector(".support-btn").addEventListener("click", function() {
                const icon = this.querySelector("i");
                const countElement = this.querySelector("span");
                let count = parseInt(countElement.textContent);
                
                if (this.classList.contains("supported")) {
                    this.classList.remove("supported");
                    icon.classList.remove("fas");
                    icon.classList.add("far");
                    countElement.textContent = count - 1;
                    showToast("已取消支持");
                } else {
                    this.classList.add("supported");
                    icon.classList.remove("far");
                    icon.classList.add("fas");
                    countElement.textContent = count + 1;
                    showToast("支持成功");
                }
            });
            
            // 点赞按钮
            document.querySelector(".like-btn").addEventListener("click", function() {
                const icon = this.querySelector("i");
                const countElement = this.querySelector("span");
                let count = parseInt(countElement.textContent);
                
                if (this.classList.contains("liked")) {
                    this.classList.remove("liked");
                    icon.classList.remove("fas");
                    icon.classList.add("far");
                    countElement.textContent = count - 1;
                    showToast("已取消点赞");
                } else {
                    this.classList.add("liked");
                    icon.classList.remove("far");
                    icon.classList.add("fas");
                    countElement.textContent = count + 1;
                    showToast("点赞成功");
                }
            });
            
            // 收藏按钮
            document.querySelector(".save-btn").addEventListener("click", function() {
                const icon = this.querySelector("i");
                
                if (icon.classList.contains("fas")) {
                    icon.classList.remove("fas");
                    icon.classList.add("far");
                    showToast("已取消收藏");
                } else {
                    icon.classList.remove("far");
                    icon.classList.add("fas");
                    showToast("收藏成功");
                }
            });
            
            // 分享按钮
            document.querySelector(".share-btn").addEventListener("click", function() {
                showToast("分享成功");
            });
            
            // 评论区点赞
            document.querySelectorAll(".comment-action.like-btn").forEach(btn => {
                btn.addEventListener("click", function() {
                    const icon = this.querySelector("i");
                    const countElement = this.querySelector("span");
                    let count = parseInt(countElement.textContent);
                    
                    if (this.classList.contains("liked")) {
                        this.classList.remove("liked");
                        icon.classList.remove("fas");
                        icon.classList.add("far");
                        countElement.textContent = count - 1;
                    } else {
                        this.classList.add("liked");
                        icon.classList.remove("far");
                        icon.classList.add("fas");
                        countElement.textContent = count + 1;
                    }
                });
            });
            
            // 回复按钮
            document.querySelectorAll(".comment-action.reply-btn").forEach(btn => {
                btn.addEventListener("click", function() {
                    const author = this.closest(".comment-content, .reply-content").querySelector(".comment-author").textContent;
                    commentInput.value = `@${author} `;
                    adjustTextareaHeight.call(commentInput);
                    commentInput.focus();
                });
            });
        }
        
        // 关闭弹窗
        function closeModal() {
            modalBackdrop.classList.remove("show");
            actionModal.classList.remove("show");
        }
        
        // 加载更多评论
        function loadMore() {
            loadMoreComments.innerHTML = '<i class="fas fa-spinner fa-spin"></i> 加载中...';
            
            // 模拟加载延迟
            setTimeout(() => {
                // 创建新评论
                const commentsList = document.querySelector(".comments-list");
                
                const newComment = document.createElement("div");
                newComment.className = "comment-item";
                newComment.innerHTML = `
                    <div class="comment-avatar">
                        <img src="https://picsum.photos/id/342/100/100" alt="用户头像">
                    </div>
                    <div class="comment-content">
                        <div class="comment-header">
                            <div class="comment-author">旅行达人</div>
                            <div class="comment-time">4天前</div>
                        </div>
                        <div class="comment-text">
                            京都的和服体验非常推荐！可以提前在网上预约，比现场租便宜很多。穿和服逛寺庙特别有感觉，很多店铺还提供发型设计服务。
                        </div>
                        <div class="comment-actions">
                            <div class="comment-action reply-btn">
                                <i class="far fa-comment"></i>
                                <span>回复</span>
                            </div>
                            <div class="comment-action like-btn">
                                <i class="far fa-heart"></i>
                                <span>19</span>
                            </div>
                        </div>
                    </div>
                `;
                
                commentsList.appendChild(newComment);
                loadMoreComments.innerHTML = "加载更多评论";
                showToast("已加载更多评论");
                
                // 为新评论添加事件监听
                const newLikeBtn = newComment.querySelector(".comment-action.like-btn");
                newLikeBtn.addEventListener("click", function() {
                    const icon = this.querySelector("i");
                    const countElement = this.querySelector("span");
                    let count = parseInt(countElement.textContent);
                    
                    if (this.classList.contains("liked")) {
                        this.classList.remove("liked");
                        icon.classList.remove("fas");
                        icon.classList.add("far");
                        countElement.textContent = count - 1;
                    } else {
                        this.classList.add("liked");
                        icon.classList.remove("far");
                        icon.classList.add("fas");
                        countElement.textContent = count + 1;
                    }
                });
                
                const newReplyBtn = newComment.querySelector(".comment-action.reply-btn");
                newReplyBtn.addEventListener("click", function() {
                    const author = this.closest(".comment-content").querySelector(".comment-author").textContent;
                    commentInput.value = `@${author} `;
                    adjustTextareaHeight.call(commentInput);
                    commentInput.focus();
                });
            }, 1000);
        }
        
        // 发送评论
        function sendComment() {
            const commentText = commentInput.value.trim();
            if (!commentText) return;
            
            // 创建新评论
            const commentsList = document.querySelector(".comments-list");
            
            const newComment = document.createElement("div");
            newComment.className = "comment-item";
            newComment.innerHTML = `
                <div class="comment-avatar">
                    <img src="https://picsum.photos/id/64/100/100" alt="我的头像">
                </div>
                <div class="comment-content">
                    <div class="comment-header">
                        <div class="comment-author">我</div>
                        <div class="comment-time">刚刚</div>
                    </div>
                    <div class="comment-text">
                        ${commentText}
                    </div>
                    <div class="comment-actions">
                        <div class="comment-action reply-btn">
                            <i class="far fa-comment"></i>
                            <span>回复</span>
                        </div>
                        <div class="comment-action like-btn">
                            <i class="far fa-heart"></i>
                            <span>0</span>
                        </div>
                    </div>
                </div>
            `;
            
            // 添加到评论列表顶部
            commentsList.insertBefore(newComment, commentsList.firstChild);
            
            // 清空输入框
            commentInput.value = "";
            adjustTextareaHeight.call(commentInput);
            
            // 更新评论数量
            const commentsCount = document.querySelector(".comments-title");
            const currentCount = parseInt(commentsCount.textContent.match(/\d+/)[0]);
            commentsCount.textContent = `留言 (${currentCount + 1})`;
            
            showToast("评论成功");
            
            // 为新评论添加事件监听
            const newLikeBtn = newComment.querySelector(".comment-action.like-btn");
            newLikeBtn.addEventListener("click", function() {
                const icon = this.querySelector("i");
                const countElement = this.querySelector("span");
                let count = parseInt(countElement.textContent);
                
                if (this.classList.contains("liked")) {
                    this.classList.remove("liked");
                    icon.classList.remove("fas");
                    icon.classList.add("far");
                    countElement.textContent = count - 1;
                } else {
                    this.classList.add("liked");
                    icon.classList.remove("far");
                    icon.classList.add("fas");
                    countElement.textContent = count + 1;
                }
            });
        }
        
        // 调整文本框高度
        function adjustTextareaHeight() {
            this.style.height = "auto";
            // 限制最大高度为100px
            this.style.height = Math.min(this.scrollHeight, 100) + "px";
        }
        
        // 显示提示消息
        function showToast(message) {
            toastMessage.textContent = message;
            toastMessage.classList.add("show");
            setTimeout(() => {
                toastMessage.classList.remove("show");
            }, 3000);
        }
        
        // 初始化页面
        document.addEventListener("DOMContentLoaded", init);
    </script>
</body>
</html>
